home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / pdselect / blizkick / modules / colour.asm < prev    next >
Assembly Source File  |  2000-02-16  |  2KB  |  99 lines

  1. ; FILE: Source:modules/Colour.ASM          REV: 10 --- Colour-bars on boot
  2.  
  3. ;
  4. ; Example BlizKick Module
  5. ; ~~~~~~~~~~~~~~~~~~~~~~~
  6. ; This code shows how to create simple BlizKick "Module".
  7. ; Should be quite self-explonary...
  8. ;
  9. ; !CODE MUST BE FULLY PC-RELATIVE!
  10. ;
  11. ; Written by Harry Sintonen.
  12. ; This source code is Public Domain.
  13. ;
  14.  
  15. ; Version 1.0 was buggy!! It wasn't PC-relative... ;-(((
  16. ;
  17.  
  18.     incdir    "include:"
  19.     include    "blizkickmodule.i"    ; Some required...
  20.  
  21.  
  22. TIME    EQU    1*50            ; Display 1 second (PAL)
  23. ;DEBUG    EQU    1            ; Enable if you want to test from CLI
  24.  
  25.  
  26.     IFD    DEBUG
  27.     SECTION    DEBUG,CODE
  28.     jsr    _init
  29.     moveq    #0,d0
  30.     rts
  31.     ENDC
  32.  
  33.  
  34.     SECTION    MODULE,CODE
  35. _DUMMY_LABEL
  36.  BK_MOD 0,_end,(RTF_COLDSTART)<<24+30<<16+NT_UNKNOWN<<8+126,_name,_idstr,_init
  37.  
  38. ; COLDSTART module, requires KS V30.x or better, module type NT_UNKNOWN, priority 126.
  39.  
  40. _init    movem.l    d0-a6,-(sp)
  41.     lea    $DFF000,a6
  42.  
  43.     move.w    ($1C,a6),d0        ; Save DMA & ints state:
  44.     swap    d0
  45.     move.w    ($02,a6),d0
  46.     or.l    #$80008000,d0
  47.     move.l    d0,-(sp)
  48.  
  49.     move.w    #$7FFF,($9A,a6)        ; All ints off!
  50.     move.w    #$01FF,($96,a6)        ; All DMA off!
  51.     move.w    #$0200,($100,a6)    ; Colour burst on!
  52.  
  53.     lea    (_colours,pc),a4    ; Do the trick:
  54.     moveq    #numcolours,d7
  55.     move.l    #(TIME*312/2)-1,d5
  56.     moveq    #1,d6
  57.  
  58. .mloop    move.l    ($04,a6),d0
  59.     lsr.l    #8,d0
  60.     andi.w    #$3FF,d0
  61.     beq.b    .dors
  62.     subq.l    #1,d6
  63.     bne.b    .nors
  64. .dors    move.l    d7,d6
  65.     move.l    a4,a0
  66. .nors    move.w    (a0)+,($180,a6)
  67.     move.b    ($06,a6),d0        ; Wait for one raster line:
  68. .wait    cmp.b    ($06,a6),d0
  69.     beq.b    .wait
  70.     dbf    d5,.mloop
  71.  
  72.     move.l    (sp)+,d0        ; Restore DMA & ints:
  73.     move.w    d0,($96,a6)
  74.     swap    d0
  75.     move.w    d0,($9A,a6)
  76.  
  77.     movem.l    (sp)+,d0-a6
  78.     rts
  79.  
  80. _colours
  81.     dc.w    $101,$101,$202,$303,$404,$505,$606,$707
  82.     dc.w    $808,$909,$A0A,$B0B,$C0C,$D0D,$E0E,$F0F
  83.     dc.w    $F0F,$F0F
  84.     dc.w    $F0F,$E0E,$D0D,$C0C,$B0B,$A0A,$909,$808
  85.     dc.w    $707,$606,$505,$404,$303,$202,$101,$101,$000
  86.  
  87. numcolours    EQU    (*-_colours)/2
  88.  
  89.  
  90. _name    dc.b    'Colour',0
  91. _idstr    dc.b    'Colour 1.3 (11.9.96)',0
  92.     CNOP    0,2
  93. _end
  94.  
  95.     SECTION    VERSION,DATA
  96.  
  97.     dc.b    '$VER: Colour_MODULE 1.3 (11.9.96)',0
  98.  
  99.